<template>
  <div>
    <div>
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick" >
      <el-tab-pane label="部门招聘信息管理" name="first" >
        <div>
          <div>
            <el-cow>
              <el-col :span="4">
                <el-button @click="InsertNewWorkDialog">新增岗位</el-button>
              </el-col>
              <el-col :span="4">
                <el-button @click="exportExcelForDepJobneed">导出部门岗位信息表</el-button>
              </el-col>
            </el-cow>
          </div>
          <div>


            <el-table
              :data="jobneed"
              :row-style="{height: '0'}"
              :cell-style="{padding: '0'}"
              style="width: 100%"
              @row-click="getDetails"
              id="out-tableforjob"
            >
              <!--        <el-table-column label width="35">-->
              <!--          <template slot-scope="scope">-->
              <!--            <el-radio :label="scope.row.name" v-model="radioId">&nbsp;</el-radio>-->
              <!--          </template>-->
              <!--        </el-table-column>-->
              <el-table-column align="center" prop="jobrage" label="招聘序列" width="80"></el-table-column>
              <el-table-column align="center" prop="departmentId" label="部门Id" width="100"fixed></el-table-column>
              <el-table-column align="center" prop="departmentName" label="部门名称" width="100" fixed></el-table-column>
              <el-table-column align="center" prop="workName" label="职位" width="100"></el-table-column>
              <el-table-column align="center" prop="baseSalary" label="基础薪资" width="100"></el-table-column>
              <el-table-column align="center" prop="userId" label="部长Id" width="75"></el-table-column>
              <el-table-column align="center" prop="username" label="部长姓名" width="100"></el-table-column>
              <el-table-column align="center" prop="needNum" label="岗位需求人数" width="120"></el-table-column>
              <el-table-column align="center" prop="description" label="职位描述" width="400"></el-table-column>

              <el-table-column fixed="right" width="400" label="操作" id="work">
                <template slot-scope="scope">
<!--                  <el-button v-show="scope.row.role == 'user'&&scope.row.iswork==`0`" @click="addNewDeper(scope.row)"style="padding: 3px" size="mini" type="success">添加部门成员</el-button>-->
<!--                  <el-button v-show="scope.row.role =='user'&&scope.row.iswork==`1`" @click="openshowDeper(scope.row)"style="padding: 3px" size="mini" type="primary">查看所属部长</el-button>-->
<!--                  <el-button v-show="scope.row.role =='department'" @click="changeNewDeper(scope.row)"style="padding: 3px" size="mini" type="warning">更换部门部长</el-button>-->
<!--                  -->
                  <el-button @click="showWorkMsg(scope.row)" style="padding: 3px" size="mini" type="success">查看岗位详细信息</el-button>
                  <el-button @click="changeMsg(scope.row)" style="padding: 3px" size="mini" type="primary">修改岗位信息</el-button>
                  <el-button @click="delWork(scope.row)"style="padding: 3px" size="mini" type="warning">删除岗位</el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>





      </el-tab-pane>
      <el-tab-pane label="面试管理" name="second">
        <div>
          <div>
            <el-cow>

              <el-col :span="4">
                <el-button @click="exportExcel">导出面试信息表</el-button>
              </el-col>
              <el-col :span="3">
                <el-button @click="selectWantedBydepartmentId">查看部门所有状态</el-button>
              </el-col>
              <el-col :span="3">
                <el-button @click="selectDepWantedByIsaccept(0)">查看审核中员工</el-button>
              </el-col>
              <el-col :span="3">
                <el-button @click="selectDepWantedByIsaccept(1)">查看面试通过员工</el-button>
              </el-col>
              <el-col :span="3">
                <el-button @click="selectDepWantedByIsaccept(2)">查看失败面试信息</el-button>
              </el-col>
              <el-col :span="3">
                <el-button @click="selectDepWantedByIsaccept(3)">查看入职员工</el-button>
              </el-col>
              <el-col :span="3">
                <el-button @click="selectDepWantedByIsaccept(4)">查看待面试员工</el-button>
              </el-col>
            </el-cow>
          </div>
          <div>


            <el-table
              :data="wanted"
              :row-style="{height: '0'}"
              :cell-style="{padding: '0'}"
              style="width: 100%"
              @row-click="getDetails"
              id="out-tableWork"
            >
              <!--        <el-table-column label width="35">-->
              <!--          <template slot-scope="scope">-->
              <!--            <el-radio :label="scope.row.name" v-model="radioId">&nbsp;</el-radio>-->
              <!--          </template>-->
              <!--        </el-table-column>-->
              <el-table-column align="center" prop="wantedrage" label="应聘序列" width="80"></el-table-column>
              <el-table-column align="center" prop="username" label="员工姓名" width="100"fixed></el-table-column>
              <el-table-column align="center" prop="idcard" label="员工身份证号码" width="140" ></el-table-column>
              <el-table-column align="center" prop="gender" label="员工性别" width="100"></el-table-column>
              <el-table-column align="center" prop="politicaltype" label="员工政治面貌" width="110"></el-table-column>
              <el-table-column align="center" prop="nationId" label="员工民族" width="80"></el-table-column>
              <el-table-column align="center" prop="address" label="员工地址" width="150"></el-table-column>
              <el-table-column align="center" prop="email" label="员工邮箱" width="150"></el-table-column>
              <el-table-column align="center" prop="phone" label="员工电话号码" width="110"></el-table-column>
              <el-table-column align="center" prop="education" label="员工最高学历" width="80"></el-table-column>
              <el-table-column align="center" prop="educationsubject" label="员工专业" width="120"></el-table-column>
              <el-table-column align="center" prop="school" label="员工最高学历毕业院校" width="120" ></el-table-column>
              <el-table-column align="center" prop="departmentId" label="员工所属部门id" width="100" fixed></el-table-column>
              <el-table-column align="center" prop="departmentName" label="员工所属部门名称" width="100"fixed></el-table-column>
              <el-table-column align="center" prop="workName" label="员工职位" width="75"fixed></el-table-column>
              <el-table-column align="center" prop="baseSalary" label="员工基础工资" width="110"></el-table-column>
              <el-table-column align="center" prop="isaccept" label="进程状态" width="100">

                <template slot-scope="scope">
                  <span v-if="scope.row.isaccept == 4" class="el-icon-info" style="color:yellow;"></span>
                  <span v-if="scope.row.isaccept == 3" class="el-icon-info" style="color:blue;"></span>
                  <span v-if="scope.row.isaccept == 2" class="el-icon-info" style="color:red;"></span>
                  <span v-if="scope.row.isaccept == 1" class="el-icon-success" style="color:rgb(103, 194, 58);"></span>
                  <span v-if="scope.row.isaccept == 0" class="el-icon-question" style="color: gray;"></span>
                  {{ changeIsaccept(scope.row)}}
                </template>


              </el-table-column>
              <el-table-column align="center" prop="workExperience" label="求职工作经历、项目介绍" width="400"></el-table-column>
              <el-table-column align="center" prop="wantedDate" label="求职时间" width="400"></el-table-column>
              <el-table-column align="center" prop="getDate" label="入职时间" width="400"></el-table-column>

              <el-table-column fixed="right" width="400" label="操作">
                <template slot-scope="scope">
                  <!--                  <el-button v-show="scope.row.role == 'user'&&scope.row.iswork==`0`" @click="addNewDeper(scope.row)"style="padding: 3px" size="mini" type="success">添加部门成员</el-button>-->
                  <!--                  <el-button v-show="scope.row.role =='user'&&scope.row.iswork==`1`" @click="openshowDeper(scope.row)"style="padding: 3px" size="mini" type="primary">查看所属部长</el-button>-->
                  <!--                  <el-button v-show="scope.row.role =='department'" @click="changeNewDeper(scope.row)"style="padding: 3px" size="mini" type="warning">更换部门部长</el-button>-->
                  <!--                  -->
                  <el-button @click="showWorkerMsg(scope.row)" style="padding: 3px" size="mini" type="success">查看详细信息</el-button>
                  <el-button v-show="scope.row.isaccept==4" @click="updateWantedIsacceptBywantedrage(scope.row,1)" style="padding: 3px" size="mini" type="primary">入职考核通过</el-button>
                  <el-button v-show="scope.row.isaccept==4" @click="updateWantedIsacceptBywantedrage(scope.row,2)"style="padding: 3px" size="mini" type="warning">面试失败</el-button>
                  <el-button v-show="scope.row.isaccept==2" @click="delwantedByWantedrage(scope.row)"style="padding: 3px" size="mini" type="warning">删除应聘信息</el-button>

                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>



      </el-tab-pane>

    </el-tabs>

      <el-dialog
        title="新增岗位信息"
        :visible.sync="openInsertDialog"
        width="80%"
        :before-close="handleClose">
        <el-form ref="form" label-width="100px" v-model="jobneeds" >
          <el-row>

            <el-col :span="6">
              <el-form-item label="部长ID" prop="name">
                <el-input v-model="jobneeds.userId" disabled="true" ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="部长姓名" prop="name">
                <el-input v-model="jobneeds.username" disabled="true"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="部门ID" prop="name">
                <el-input v-model="jobneeds.departmentId" disabled="true"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="部门名" prop="name">
                <el-input v-model="jobneeds.departmentName" disabled="true"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="职位" prop="name">
                <el-input v-model="jobneeds.workName" ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="基础薪资" prop="name">
                <el-input v-model="jobneeds.baseSalary" ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="需求人数" prop="name">
                <el-input v-model="jobneeds.needNum" ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="18">
              <el-form-item label="岗位说明" prop="name">
                <el-input
                  type="textarea"
                  :autosize="{minRows:3,maxRows:6}"
                  v-model="jobneeds.description" ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="" prop="name">
                <el-button @click="InsertNewWork">创建岗位</el-button>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="" prop="name">
                <el-button @click="openInsertDialog=false">取消</el-button>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>


      </el-dialog>
      <el-dialog
        title="修改岗位信息"
        :visible.sync="changeMsgDialog"
        width="80%"
        :before-close="handleClose">
        <el-form ref="form" label-width="100px" v-model="jobneeds" >
          <el-row>
            <el-col :span="6">
              <el-form-item label="部长ID" prop="name">
                <el-input v-model="jobneeds.userId" disabled="true" ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="部长姓名" prop="name">
                <el-input v-model="jobneeds.username" disabled="true"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="部门ID" prop="name">
                <el-input v-model="jobneeds.departmentId" disabled="true"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="部门名" prop="name">
                <el-input v-model="jobneeds.departmentName" disabled="true"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="职位" prop="name">
                <el-input v-model="jobneeds.workName" disabled="true"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="基础薪资" prop="name">
                <el-input v-model="jobneeds.baseSalary" ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="需求人数" prop="name">
                <el-input v-model="jobneeds.needNum" ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="18">
              <el-form-item label="岗位说明" prop="name">
                <el-input
                  type="textarea"
                  :autosize="{minRows:3,maxRows:6}"
                  v-model="jobneeds.description" ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="" prop="name">
                <el-button @click="ChangeThisWork">修改岗位</el-button>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="" prop="name">
                <el-button @click="changeMsgDialog=false">取消</el-button>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>


      </el-dialog>
  </div>


  </div>


</template>

<script>
  import FileSaver from 'file-saver'
  import XLSX from 'xlsx'
    export default {
        name: "depjob",
      data()
      {
        return{
          activeName:"first",
          openInsertDialog:false,
          jobneed:[],

          jobneeds:{
            jobrage:"",
            departmentId:"",
            departmentName:"",
            userId:"",
            username:"",
            workName:"",
            baseSalary:"",
            description:"",
            needNum:"",
          },
          wanted:[],
          changeMsgDialog:false,
          wanteds:{
            wantedrage:"",
            username:"",
            idcard:"",
            gender:"",
            politicaltype:"",
            nationId:"",
            address:"",
            email:"",
            phone:"",
            education:"",
            educationsubject:"",
            school:"",
            departmentId: "",
            departmentName: "",
            workName:"",
            baseSalary: "",
            workExperience:"",
            isaccept:""
          },
        }
      },
      mounted() {
        this.$store.state.departmentId = window.sessionStorage.getItem("departmentId")
        this.$store.state.userId = window.sessionStorage.getItem("userId")

        this.selectAllJobneedBydepartmentId()

          },
      methods:
        {
          handleClick(tab, event) {
            if (tab.index == 0) {
              // alert("啦啦啦")
            } else if (tab.index == 1) {

                this.selectWantedBydepartmentId()


            }
          },
          delwantedByWantedrage(data)
          {
            this.$axios.post("/wanted/deleteWantedByWantedRage",{
              wantedrage:data.wantedrage
            }).then((res)=>{
              this.$message.success(res.data.msg)
            }).catch(()=>{
              this.$message.error("删除失败")
            }).finally(()=>{
              this.selectWantedBydepartmentId()
            })
          },
          updateWantedIsacceptBywantedrage(data,isaccept)
          {
              this.$axios.post(("/wanted/updateWantedIsacceptBywantedrage"),{
                wantedrage:data.wantedrage,
                isaccept:isaccept,
              }).then((res)=>{
                this.$message.success(res.data.msg)
              }).catch(()=>{
                this.$message.error("修改失败")
              }).finally(()=>{
                this.selectWantedBydepartmentId()
              })
          },
          updateAllWantedIsacceptBywantedrage(data,isaccept)
          {
            this.$axios.post(("/wanted/updateWantedIsacceptBywantedrage"),{
              wantedrage:data.wantedrage,
              isaccept:isaccept,
            }).then((res)=>{
              this.$message.success(res.data.msg)
            }).catch(()=>{
              this.$message.error("修改失败")
            }).finally(()=>{
              this.selectAllJobneedBydepartmentId()
            })
          },
          selectAllWanted()
          {
            this.$axios.post("/wanted/selectAllWanted",{

            }).then((res)=>{
              this.wanted = res.data
              alert(JSON.stringify(res.data))
             this.$message.success("加载成功！")
            })
          },
          selectWantedBydepartmentId()
          {
            this.$axios.post("/wanted/selectWantedBydepartmentId",{
            departmentId:this.$store.state.departmentId
            }).then((res)=>{
              this.wanted = res.data
              // alert(JSON.stringify(res.data))
              this.$message.success("加载成功！")
            })
          },
          selectDepWantedByIsaccept(data)
          {
            this.$axios.post("/wanted/selectWantedByDepartmentIdAndIsaccept",{
              departmentId:this.$store.state.departmentId,
              isaccept:data,
            }).then((res)=>{

              this.wanted = []
              this.wanted = res.data
              this.$message.success("加载成功")
            })
          },
          selectWantedByIsaccept(data)
          {
            this.$axios.post("/wanted/selectWantedByIsaccept",{
              isaccept:data
            }).then((res)=>{

              this.wanted = []
              this.wanted = res.data
              this.$message.success("加载成功")
            })
          },
          changeIsaccept(row)
          {
            if(row.isaccept=='1')
            {
              return "面试通过"
            }
            else if(row.isaccept=='0'){
              return "未审核"
            }
            else if(row.isaccept=='2'){
              return "面试失败"
            }
            else if(row.isaccept=='3')
            {
              return "正式员工"
            }else if(row.isaccept=='4')
            {
              return "等待面试"
            }
          },
          InsertNewWork() {
            this.$axios.post("/Jobneed/InsertJobneed",{
              departmentId:this.jobneeds.departmentId,
              departmentName:this.jobneeds.departmentName,
              userId:this.jobneeds.userId,
              username:this.jobneeds.username,
              workName:this.jobneeds.workName,
              baseSalary:this.jobneeds.baseSalary,
              description:this.jobneeds.description,
              needNum:this.jobneeds.needNum
            }).then((res)=>{

              this.$message.success(res.data.msg)
              this.openInsertDialog = false
            }).catch(()=>{
              this.$message.error("新建失败！职位名不可重复!")
            }).finally(()=>{
              this.selectAllJobneedBydepartmentId()

            })

          },
          ChangeThisWork() {

            this.$axios.post("/Jobneed/UpdateJobneedByJobrage",{

              jobrage:this.jobneeds.jobrage,
              departmentId:this.jobneeds.departmentId,
              departmentName:this.jobneeds.departmentName,
              userId:this.jobneeds.userId,
              username:this.jobneeds.username,
              workName:this.jobneeds.workName,
              baseSalary:this.jobneeds.baseSalary,
              description:this.jobneeds.description,
              needNum:this.jobneeds.needNum,
            }).then((res)=>{
              this.$message.success(res.data.msg)
            }).catch(()=>{
              this.$message.error("修改失败！")
            }).finally(()=>{
              this.selectAllJobneedBydepartmentId()
              this.changeMsgDialog = false
            })



          },
          InsertNewWorkDialog() {
            alert(JSON.stringify(this.$store.state.userId))
            this.$axios.post("/Jobneed/SelectDepUserNameBeforeInsert",{
              userId:this.$store.state.userId
            }).then((res)=>{


              this.jobneeds.username = res.data.username
              this.jobneeds.departmentName = res.data.departmentName
              this.jobneeds.userId = this.$store.state.userId
              this.jobneeds.departmentId = this.$store.state.departmentId
              this.jobneeds.workName="",
                this.jobneeds.baseSalary="",
                this.jobneeds.description="",
                this.jobneeds.needNum=""
              this.jobneeds.jobrage = ""
            })
            this.openInsertDialog = true;
          },
          handleClose() {
            this.openInsertDialog = false
          },
          showWorkMsg(data) {
            alert("岗位信息：\n部门Id：" +
              JSON.stringify(data.departmentId).replace(/\"/g, "") + ";\n部门名称：" +
              JSON.stringify(data.departmentName).replace(/\"/g, "") + "；\n部长ID：" +
              JSON.stringify(data.userId).replace(/\"/g, "") + "；\n部长名称：" +
              JSON.stringify(data.username).replace(/\"/g, "") + ";\n岗位名：" +
              JSON.stringify(data.workName).replace(/\"/g, "") + ";\n需求人数：" +
              JSON.stringify(data.needNum).replace(/\"/g, "") + ";\n岗位要求：" +
              JSON.stringify(data.description).replace(/\"/g, "")
            )
          },
          showWorkerMsg(data) {
            alert("求职者信息：\n部门Id：" +
              JSON.stringify(data.departmentId).replace(/\"/g, "") + ";\n部门名称：" +
              JSON.stringify(data.departmentName).replace(/\"/g, "") + "；\n求职者姓名：" +
              JSON.stringify(data.username).replace(/\"/g, "") + ";\n岗位名：" +
              JSON.stringify(data.workName).replace(/\"/g, "") + ";\n薪资：" +
              JSON.stringify(data.baseSalary).replace(/\"/g, "") + "；\n应聘序列：" +
              JSON.stringify(data.wantedrage).replace(/\"/g, "") + ";\n员工身份证号码：" +
              JSON.stringify(data.idcard).replace(/\"/g, "") + ";\n员工性别：" +
              JSON.stringify(data.gender).replace(/\"/g, "") + ";\n员工政治面貌：" +
              JSON.stringify(data.politicaltype).replace(/\"/g, "") + ";\n员工民族：" +
              JSON.stringify(data.nationId).replace(/\"/g, "") + ";\n员工地址：" +
              JSON.stringify(data.address).replace(/\"/g, "") + ";\n员工邮箱：" +
              JSON.stringify(data.email).replace(/\"/g, "") + ";\n员工电话号码：" +
              JSON.stringify(data.phone).replace(/\"/g, "") + ";\n员工最高学历：" +
              JSON.stringify(data.education).replace(/\"/g, "") + ";\n员工专业：" +
              JSON.stringify(data.educationsubject).replace(/\"/g, "") + ";\n员工最高学历毕业院校：" +
              JSON.stringify(data.school).replace(/\"/g, "") + ";\n求职工作经历、项目介绍：" +
              JSON.stringify(data.workExperience).replace(/\"/g, "")
            )
          },
          accDep(data) {

          },
          refDep(data) {

          },
          changeMsg(data) {
            this.jobneeds = data
            this.changeMsgDialog = true
          },
          delWork(data) {
            this.$confirm('此操作将删除【' + JSON.stringify(data.workName).replace(/\"/g, "") + '】岗位的信息,是否继续？', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {

              this.$axios.post("/Jobneed/deleteJobneedByJobrage",{
                jobrage:data.jobrage
              }).then((res)=>{
                this.$message.success(res.data.msg)
              }).catch(()=>{
                this.$message.error("删除失败捏")
              }).finally(()=>{
                this.selectAllJobneedBydepartmentId()
              })
            }).catch(() => {
              this.$message({
                type: 'info',
                message: '已取消删除'
              });
            });
          },
          selectAllJobneed() {
            this.$axios.post("/Jobneed/SelectAllJobneed", {}).then((res) => {
              this.jobneed = res.data
            })
          },
          selectAllJobneedBydepartmentId()
          {
            this.$axios.post("/Jobneed/SelectAllJobneedBydepartmentId", {
              departmentId:this.$store.state.departmentId,
            }).then((res) => {

              this.jobneed = res.data
            })
          },
          exportExcel() {
            let xlsxParam = { raw: true }; //转换成excel时，使用原始的格式
            / generate workbook object from table /;
            /* 从表生成工作簿对象 */
            let table =  document.querySelector("#out-tableWork").cloneNode(true)
            // 因为element-ui的表格的fixed属性导致多出一个table，会下载重复内容，这里删除掉
            table.removeChild(table.querySelector(".el-table__fixed-right"));
            table.removeChild(table.querySelector(".el-table__fixed"));
            let wb = XLSX.utils.table_to_book(
              table ,  //elementui 表格的id
              xlsxParam
            );

            /* 获取二进制字符串作为输出 */
            var wbout = XLSX.write(wb, {
              bookType: "xlsx",
              bookSST: true,
              type: "array"
            });
            try {
              FileSaver.saveAs(
                //Blob 对象表示一个不可变、原始数据的类文件对象。
                //Blob 表示的不一定是JavaScript原生格式的数据。
                //File 接口基于Blob，继承了 blob 的功能并将其扩展使其支持用户系统上的文件。
                //返回一个新创建的 Blob 对象，其内容由参数中给定的数组串联组成。
                new Blob([wbout], { type: "application/octet-stream" }),
                //设置导出文件名称
                "部门岗位表.xlsx"
              );
            } catch (e) {
              if (typeof console !== "undefined") console.log(e, wbout);
            }
            return wbout;
          },
          exportExcelForDepJobneed() {
            let xlsxParam = { raw: true }; //转换成excel时，使用原始的格式
            / generate workbook object from table /;
            /* 从表生成工作簿对象 */
            let table =  document.querySelector("#out-tableforjob").cloneNode(true)
            // 因为element-ui的表格的fixed属性导致多出一个table，会下载重复内容，这里删除掉
            table.removeChild(table.querySelector(".el-table__fixed-right"));
            table.removeChild(table.querySelector(".el-table__fixed"));
            let wb = XLSX.utils.table_to_book(
              table ,  //elementui 表格的id
              xlsxParam
            );

            /* 获取二进制字符串作为输出 */
            var wbout = XLSX.write(wb, {
              bookType: "xlsx",
              bookSST: true,
              type: "array"
            });
            try {
              FileSaver.saveAs(
                //Blob 对象表示一个不可变、原始数据的类文件对象。
                //Blob 表示的不一定是JavaScript原生格式的数据。
                //File 接口基于Blob，继承了 blob 的功能并将其扩展使其支持用户系统上的文件。
                //返回一个新创建的 Blob 对象，其内容由参数中给定的数组串联组成。
                new Blob([wbout], { type: "application/octet-stream" }),
                //设置导出文件名称
                "部门岗位表.xlsx"
              );
            } catch (e) {
              if (typeof console !== "undefined") console.log(e, wbout);
            }
            return wbout;
          },
        }
    }
</script>

<style scoped>

</style>
